import 'dart:developer';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';


/// todo: 日志打印
/// 默认只在debug下打印
/// showLet 默认关闭，一般数据比较多时开启 方便在控制台查阅
/// kDebugMode == true 则为Debug模式
/// kReleaseMode == true 则为Release模式
void logger(msg,{bool showLabel,String name,int level, bool isDebug,}) {
  // isDebug为空 则只在 debug模式下打印
  bool _debug = isDebug == null ? kDebugMode  : kReleaseMode;
  // 使用
  if (_debug) {
    if (showLabel == true)log('+++++++++++++++++',name: '${isDebug == null ? "debug" : "release"}打印 开始',);
    log( "=> $msg", level: level ?? 0, name:" time = ${DateFormat("HH:mm:ss").format(DateTime.now())},name = ${name ?? 'log'} ",);
    if (showLabel == true) log('+++++++++++++++++',name: '${isDebug == null ? "debug" : "release"}打印 结束',);
  }
}